export default (http) => {
	const request = (method, url, data = {}) => {
		return http.request({
			method,
			url,
			data,
		}).catch(error => {
			console.error(`Error during request to ${url}:`, error);
			throw error; // 重新抛出错误以便上层处理
		});
	};

	return {
		login(data = {}) {
			return request('POST', '/api/user/login', data);
		},
		register(data = {}) {
			return request('POST', '/api/user/register', data);
		},
		getBanners() {
			return request('GET', '/api/minishop/banner/getBanners');
		},
		getNotices() {
			return request('GET', '/api/minishop/index/getNotices');
		},
		getIcongroup() {
			return request('GET', '/api/minishop/index/getIcongroup');
		},
		getProduct() {
			return request('GET', '/api/minishop/goods/index');
		},
		setRed() {
			return request('GET', '/api/minishop/index/setRed');
		},

	};
};